export default {
    namespaced: true,
    state: {
        //控制是否显示提示框
        isShow: false,
        //提示信息
        toastMsg: '默认提示内容..',
        // 提示图标(success 成功， danger 失败提示，warning警号)
        toastType: 'danger'
    },
    mutations: {
        changeIsShowToast(state, payload) {
            state.isShow = payload.isshow;
            if (payload.isshow) {
                state.toastMsg = payload.msg;
                state.toastType = payload.type;
            }
        }
    },
    actions: {
        // 异步
        asyncIsShowToast({ commit }, payload) {
            commit('changeIsShowToast', payload)
            setTimeout(() => {
                commit('changeIsShowToast', {
                    isshow: false
                })
            }, 2000)
        }
    }
}